using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using PerlinNoise;
using PerlinNoise.NoiseGenerator;
using PerlinNoise.Interpolator;
using PerlinNoise.Smoother;

namespace PerlinNoise
{
    public class SummedPerlinNoiseOperator : AbstractPerlinNoiseOperator
    {
        private uint octavesNumber;
        private double persistence;

        public SummedPerlinNoiseOperator()
        {
            this.octavesNumber = 4;
            this.persistence = 0.5d;
        }

        public override bool showOptionsForm(Form parent)
        {
            bool updateNeeded = false;
            
            SummedPerlinNoiseOptions optionsForm = new SummedPerlinNoiseOptions(this.octavesNumber, this.persistence);
            if (optionsForm.ShowDialog() == DialogResult.OK) {
                this.octavesNumber = optionsForm.OctavesNumber;
                this.persistence = optionsForm.Persistence;
                updateNeeded = true;
            }

            return updateNeeded;
        }

        public override AbstractPerlinNoise createPerlinNoiseInstance(AbstractNoiseGenerator noiseGenerator, AbstractInterpolator interpolator, AbstractSmoother smoother)
        {
            return new SummedPerlinNoise(this.octavesNumber, this.persistence, noiseGenerator, interpolator, smoother);
        }
    }
}
